<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html>
<head>
<meta charset=UTF-8>
<title>客户管理系统</title>
<base href="<%=basePath%>">
<link rel="stylesheet" type="text/css"
	href="bootstrap-rs/themes/black/easyui.css">
<link rel="stylesheet" type="text/css"
	href="bootstrap-rs/themes/icon.css">
<link rel="stylesheet" type="text/css" href="bootstrap-rs/demo.css">
<script type="text/javascript" src="bootstrap-rs/jquery.min.js"></script>
<script type="text/javascript" src="bootstrap-rs/jquery.easyui.min.js"></script>
</head>
<body>
	<form class="form-inline definewidth m20"
		action="sys/data/queryByFatherId" id="pager" method="post">
		父类: <select name="fid">
			<option value="99999">请选择</option>
			<c:forEach items="${fathers }" var="b">
				<c:if test="${b.fid eq 0 }">
					<option value="${b.id }">${b.name }</option>
				</c:if>
			</c:forEach>
		</select> &nbsp;&nbsp;


		<button type="submit" class="btn btn-primary">查询</button>
		&nbsp;&nbsp;
		<button type="button" class="btn btn-success" id="addnew">新增字典</button>
	</form>
	<table class="table table-bordered table-hover definewidth m10">
		<thead>
			<tr>
				<th>字典ID</th>
				<th>字典名称</th>
				<th>父类ID</th>
				<th>操作</th>
			</tr>
		</thead>
		<c:forEach items="${data }" var="dat">
			<c:if test="${dat.fid eq 0 }">
				<tr>
					<td>${dat.id }</td>
					<td>${dat.name }</td>
					<td>${dat.fid }</td>
					<td><a href="sys/data/updateData?id=${dat.id  }">修改</a> <a
						href="sys/data/delete?id=${dat.id }">删除</a>
				</tr>

				<c:forEach items="${data }" var="d">
					<c:if test="${d.fid eq dat.id }">
						<tr>
							<td>${d.id }</td>
							<td style="padding-left: 40px">${d.name }</td>
							<td>${d.fid }</td>
							<td><a href="sys/data/updateData?id=${d.id  }">修改</a> <a
								href="sys/data/delete?id=${d.id }">删除</a>
						</tr>
					</c:if>
				</c:forEach>
			</c:if>
		</c:forEach>

	</table>
</body>
<script>

	$(function() {
		$('#addnew').click(function() {
			window.location.href = "sys/data/addData";
		});
	});
	
</script>

</html>